<?php if(is_array($items)): ?>
	<?php foreach ($items as $item): ?>
		<form action="<?php echo base_url(); ?>cart/add_cart" method='post'>
		    <div class='col-md-4 span7 text-center' id="item" >
			<a id="popoverData" class="btn" href="<?php echo base_url(); ?>item/get_info_item_by_id/<?php print $item->ITEM_ID ?>" rel="popover" data-placement="right" data-trigger="hover" data-html="true"
				style="text-decoration: none;" data-title="<p class='productinfo'><b><?php print $item->ITEM_NAME; ?></b></p>" 
				data-content =
				"
					<div>
						<div class='row'>
							<div class='rarity' style='background-color: #8847ff;'>
								<?php print $item->ITEM_RARITY; ?>
							</div>
						</div>
						<br/>
						<div class='row'>
							<div class='info'>
		    					<div class='col-lg-6' id='popoverinfo'>
		    						<div class='row'>
			    						Hero:<p><?php if(($item->HERO_NAME) == ''){print "All Heroes";} else {print $item->HERO_NAME;} ?></p>
		    						</div>
		    					</div>
		    					<div class='col-lg-6' id='popoverinfo'>
		    						<div class='row'>
			    						Slot:<p>N/A</p>
			    					</div>
		    					</div>
		        			</div>
						</div>
					</div>
				"
			>
				<div class="row">
				<?php $sample_data = $this->m_item->get_new_saleoff_chung();
					if($sample_data[0]->SAMPLE_VALUE != 1 || $item->IS_SALE == 1) { ?>
				 <span class="div_sale">
						<?php
												        if($item->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												            echo ($saleoff - 1)*100 .'%' ;
												        }
												        else if($item->IS_SALE == 1)
												        {
												            $saleoff1 = $this->m_item->get_new_saleoff_by_itemid($item->ITEM_ID);
												            $saleoff = $saleoff1[0]->SOVALUE;
												            echo ($saleoff - 1)*100 .'%' ;

												        }

												         
						?>

				</span>   <?php } ?>
		        	<img class="productimage" src="<?php print $item->ITEM_IMAGE; ?>">
		        </div>
		  
		        <div class="row">
		        	<p class="productinfo"><b><?php print $item->ITEM_NAME; ?></b></p>
		        	<p class="productinfo"><b><?php if($item->PRICE != '') echo $item->PRICE; else echo $item->PRICEVN; ?> VND</b></p>
		        </div>
		    </a>
		    	<?php if($this->session->userdata('username') != ''): ?>
		        	<button type='submit' name='btnAction' value='addcart' class="btn btn-success" >Add to Cart</button>
		    	<?php else: ?>
		    		<button type='submit' name='btnAction' value='addcart' class="btn btn-success" disabled >Add to Cart</button>
		    	<?php endif; ?>
		        <input type='hidden' name='productid' value='<?php print $item->ITEM_ID; ?>' />
		        <input type='hidden' name='type' value='add' />
		    </div>
		</form>
	<?php endforeach; ?>
<?php endif; ?>